---
apiVersion: v1
kind: ServiceAccount
metadata:
  labels:
    component: "node-exporter"
    app: prometheus
  name: prometheus-node-exporter
  namespace: {{ .Namespace }}
---
apiVersion: v1
kind: Service
metadata:
  annotations:
    prometheus.io/scrape: "true"
  labels:
    component: "node-exporter"
    app: prometheus
  name: prometheus-node-exporter
  namespace: {{ .Namespace }}
spec:
  clusterIP: None
  ports:
    - name: metrics
      port: 9100
      protocol: TCP
      targetPort: 9100
  selector:
    component: "node-exporter"
    app: prometheus
  type: "ClusterIP"
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
  labels:
    component: "node-exporter"
    app: prometheus
  name: prometheus-node-exporter
  namespace: {{ .Namespace }}
spec:
  selector:
    matchLabels:
      component: "node-exporter"
      app: prometheus
  updateStrategy:
    type: RollingUpdate
  template:
    metadata:
      labels:
        component: "node-exporter"
        app: prometheus
        kuma.io/sidecar-injection: "disabled" # disabled for now, injecting DP crashes K8S cluster
    spec:
      serviceAccountName: prometheus-node-exporter
      containers:
        - name: prometheus-node-exporter
          image: "prom/node-exporter:v1.3.1"
          imagePullPolicy: "IfNotPresent"
          args:
            - --path.procfs=/host/proc
            - --path.sysfs=/host/sys
          ports:
            - name: metrics
              containerPort: 9100
              hostPort: 9100
          resources:
            {}
          volumeMounts:
            - name: proc
              mountPath: /host/proc
              readOnly:  true
            - name: sys
              mountPath: /host/sys
              readOnly: true
      hostNetwork: true
      hostPID: true
      volumes:
        - name: proc
          hostPath:
            path: /proc
        - name: sys
          hostPath:
            path: /sys
